package xyz.weizhi.dao;

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import xyz.weizhi.domain.book;

import java.util.List;
/**
 * @Author milian
 * @Date 2021/9/15 0015 9:38
 */
@Repository
public interface bookDao {
    /**
     * @Author milian
     * @Description 查询所有
     * @Date 9:42 2021/9/15 0015
     * @Param []
     * @return java.util.List<xyz.weizhi.domain.book>
     **/
    @Select("select * from tbl_book")
    List<book> selectAllBook();
    /**
     * @Author milian
     * @Description 根据名字查询
     * @Date 9:42 2021/9/15 0015
     * @Param []
     * @return java.util.List<xyz.weizhi.domain.book>
     **/
    @Select("select * from tbl_book where name =#{name}")
    List<book> selectBookByName(@Param("name") String name);
    /**
     * @Author milian
     * @Description 添加
     * @Date 9:43 2021/9/15 0015
     * @Param [book]
     * @return void
     **/
    @Insert("insert into tbl_book values(null,#{type},#{name},#{description})")
    void addBook(book book);
    /**
     * @Author milian
     * @Description 更新
     * @Date 9:43 2021/9/15 0015
     * @Param [id]
     * @return void
     **/
    @Update("update tbl_book set type=#{type},name=#{name},description=#{description} where id=#{id}")
    void updateBookById(Integer id);
    /**
     * @Author milian
     * @Description 删除
     * @Date 9:43 2021/9/15 0015
     * @Param [id]
     * @return void
     **/
    @Delete("delete from tbl_book where id=#{id}")
    void deleteBookById(Integer id);
}
